
package testes;

import java.util.Arrays;

import org.jdom.Element;

public class Regra extends Element
{

   protected String[] chaves;
   protected String acao;

   public Regra()
   {
      super("regra");
   }

   public void addChaves(String[] values)
   {
      chaves = values;
      Element chaves = new Element("chaves");
      Element[] elements = new Element[values.length];
      for (int i = 0; i < elements.length; i++)
      {
         elements[i] = new Element("chave");
         elements[i].setAttribute("nome", values[i]);
      }
      chaves.addContent(Arrays.asList(elements));
      this.addContent(chaves);
   }

   public String[] getChaves()
   {
      return chaves;
   }

   public void setAcao(String acao)
   {
      this.acao = acao;
   }

   public String getAcao()
   {
      return acao;
   }

}
